<?php

require_once 'mysqlconnect.php';

function testlogin($n, $p) {
    $n = escape_data($n);
    $p = escape_data($p);

    global $dbc;
    $query = "SELECT * FROM user_account WHERE userid='" . $n . "'";
    $result = mysqli_query($dbc, $query);
    $row = mysqli_fetch_array($result, MYSQL_NUM);
    if ($row) {
        if ($row [1] == $p) {
        	echo "$row[1]";
            session_name('YourVisitID');
            session_start ();
            $_SESSION ['name'] = $row [0];
            $_SESSION ['password'] = $row [1];
            mysqli_close($dbc);
            $url = "http://localhost/e-commerce/manager_php/manage_goods.php";
            header("Location: $url");
        }
    }
}

?>
